import { Device } from "@/api/interface/iot";
import http from "@/api";
import { ResPage } from "@/api/interface/index";

/**
 * @name 硬网关管理模块
 */

// * 获取硬列表
export const getProductList = (params: Device.ReqProduct) => {
	return http.get<ResPage<Device.ResProduct[]>>(`/product/find`, params);
};
// * 新增硬列表
export const addProduct = (params: Device.ResProduct) => {
	return http.post<any>(`/product/add`, params);
};
// * 复制产品
export const copyProduct = (params: Device.ResProduct) => {
	return http.post<any>(`/product/copy`, params);
};
// * 删除硬列表
export const removeProduct = (params: Device.ResProduct) => {
	return http.post(`/product/remove`, params);
};
// * 获取硬列表详情
export const getProduct = (params: Device.ReqProduct) => {
	return http.get<Device.ResProduct>(`/product/get`, params);
};
// * 编辑硬列表
export const modifyProduct = (params: Device.ResProduct) => {
	return http.post(`/product/modify`, params);
};

// * 添加网关系统参数
export const productSystemAdd = (params: Device.ResProduct) => {
	return http.post(`/product/props/system/add`, params, { headers: { noLoading: true } });
};
// * 编辑网关系统参数
export const productSystemModify = (params: Device.ResProduct) => {
	return http.post(`/product/props/system/modify`, params);
};
// * 删除网关系统参数
export const productSystemRemove = (params: Device.ResProduct) => {
	return http.post(`/product/props/system/remove`, params);
};

// * 添加网关测量量
export const productSensorAdd = (params: Device.ResProduct) => {
	return http.post(`/product/props/sensor/add`, params);
};
// * 编辑网关测量量
export const productSensorModify = (params: Device.ResProduct) => {
	return http.post(`/product/props/sensor/modify`, params);
};
// * 删除网关测量量
export const productSensorRemove = (params: Device.ResProduct) => {
	return http.post(`/product/props/sensor/remove`, params);
};

// * 添加网关下位机配置
export const productConfigSubdeviceAdd = (params: Device.ResProduct) => {
	return http.post(`/product/config/subdevice/add`, params);
};
// * 编辑网关下位机配置
export const productConfigSubdeviceModify = (params: Device.ResProduct) => {
	return http.post(`/product/config/subdevice/modify`, params);
};
// * 删除网关下位机配置
export const productConfigSubdeviceRemove = (params: Device.ResProduct) => {
	return http.post(`/product/config/subdevice/remove`, params);
};
// * 添加网关下位机采集配置
export const productConfigSensorAdd = (params: Device.ResProduct) => {
	return http.post(`/product/config/sensor/add`, params);
};
// * 编辑网关下位机采集配置
export const productConfigSensorModify = (params: Device.ResProduct) => {
	return http.post(`/product/config/sensor/modify`, params);
};
// * 删除网关下位机采集配置
export const productConfigSensorRemove = (params: Device.ResProduct) => {
	return http.post(`/product/config/sensor/remove`, params);
};
// * 添加网关配置schema
export const productConfigGatewayAdd = (params: Device.ResProduct) => {
	return http.post(`/product/config/gateway/add`, params);
};
// * 编辑网关配置schema
export const productConfigGatewayModify = (params: Device.ResProduct) => {
	return http.post(`/product/config/gateway/modify`, params);
};
// * 删除网关配置schema
export const productConfigGatewayRemove = (params: Device.ResProduct) => {
	return http.post(`/product/config/gateway/remove`, params);
};
// * 编辑网关配置profile
export const productConfigModify = (params: Device.ResProduct) => {
	return http.post(`/product/config/modify`, params);
};
// * 新增网关配置profile
export const productConfigAdd = (params: Device.ResProduct) => {
	return http.post(`/product/config/add`, params);
};
export const productBasicConfigRemove = (params: Device.ResProduct) => {
	return http.post(`/product/config/basic/add`, params);
};
export const productBasicConfigModify = (params: Device.ResProduct) => {
	return http.post(`/product/config/basic/add`, params);
};
export const productBasicConfigAdd = (params: Device.ResProduct) => {
	return http.post(`/product/config/basic/add`, params);
};
export const syncFromProduct = (params: { productModel: string; sn?: string }) => {
	return http.post(`/product/devSync`, params);
};
